Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug of duplicate record keys of indexed files. #607

Merged

Conversation

yutaro-sakamoto
Copy link
Contributor

This pull request includes several changes to the CobolIndexedFile class in order to fix a bug of duplicate record keys.
With previous version, executing the program in a new test causes an infinite loop.

@yutaro-sakamoto yutaro-sakamoto marked this pull request as ready for review March 11, 2025 01:15
@yutaro-sakamoto yutaro-sakamoto requested a review from n-isaka March 11, 2025 01:16
@yutaro-sakamoto yutaro-sakamoto requested a review from Copilot March 28, 2025 06:20
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug related to duplicate record keys in indexed files that was causing an infinite loop in new test executions. Key changes include:

  • Introducing and resetting a new field (fetchKeyIndex) to manage duplicate key fetching.
  • Overloading and modifying indexed_write_internal and indexed_delete_internal to incorporate handling for duplicate numbers.
  • Adding logic to save and reuse duplicate numbers during write and delete operations.
Files not reviewed (1)
  • tests/misc.src/record-key-duplicates-error.at: Language not supported
Comments suppressed due to low confidence (1)

libcobj/app/src/main/java/jp/osscons/opensourcecobol/libcobj/file/CobolIndexedFile.java:604

  • The condition 'i != this.fetchKeyIndex' may not correctly distinguish when to reuse a duplicate number. Please verify that fetchKeyIndex is set appropriately and that the condition accurately reflects the intended logic for duplicate handling.
if (dupNumbers == null || dupNumbers[i] < 0 || i != this.fetchKeyIndex) {

@yutaro-sakamoto yutaro-sakamoto merged commit a1c08e0 into opensourcecobol:develop Mar 28, 2025
417 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant